﻿using System;

namespace PPHandler
{
    class Program
    {
        static void Main(string[] args)
        {
            if (args.Length < 2)
            {
                Console.WriteLine("Ungültige Funktionsauswahl!");
                return;
            }
            
            if ("SHOW".Equals(args[0]))
            {
                showPPTable(Int16.Parse(args[1]));
            }
            else if ("TITLE".Equals(args[0]))
            {
                String title = getPPTableWinTitle(Int16.Parse(args[1]));
                Console.WriteLine(title);
            }
            else if ("CLICK".Equals(args[0]))
            {
                int x = UInt16.Parse(args[1]);
                int y = UInt16.Parse(args[2]);
                Util.leftClick(x, y);
            }
            else
            {
                Console.WriteLine("Ungültige Funktionsauswahl!");
            }
        }

        public static void showPPTable(int tnr)
        {
            Window window = Util.GetPPTableWindow(tnr);

            window.show();
        }

        public static String getPPTableWinTitle(int tnr)
        {
            Window window = Util.GetPPTableWindow(tnr);
            if (window == null) return null;
            return window.title;
        }
    }
}
